﻿/**
 * 
 * @file SectionInfoDialog.h
 * @brief 截面信息对话框
 * @author BaGuijun (baguijun@163.com)
 * @date 2024-04-07
 * 
 */
#ifndef SECTIONINFODIALOG_H
#define SECTIONINFODIALOG_H


#include "GUIPropertyDialogAPI.h"
#include "GUIWidget/GUIDialogBase.h"
#include "FITK_Interface/FITKInterfaceStructural/FITKAbaAbstractSection.h"
#include "OperatorsInterface/ParaWidgetInterfaceOperator.h"

class QDialog;

namespace Ui{
    class SectionInfoDialog;
}

namespace Interface{
    class FITKAbstractSection;
    class FITKAbaAbastractSection;
    class FITKAbaProfile;
}

namespace EventOper {
    class ParaWidgetInterfaceOperator;
}

namespace GUI
{
    /**
     * @brief 截面信息对话框
     * @author BaGuijun (baguijun@163.com)
     * @date 2024-04-07
     */
    class GUIPropertyDialogAPI SectionInfoDialog : public GUIDialogBase
    {
        Q_OBJECT;
    public:
        /**
         * @brief 创建构造函数
         * @param[i]  mw             主窗口对象
         * @param[i]  oper           操作器对象
         * @param[i]  name           名称
         * @param[i]  type           类型
         * @author BaGuijun (baguijun@163.com)
         * @date 2024-04-25
         */
        SectionInfoDialog(QWidget* mw, EventOper::ParaWidgetInterfaceOperator* oper, QString name,
            Interface::FITKAbaAbastractSection::FITKAbaSectionType type);
        /**
         * @brief 编辑构造函数
         * @param[i]  mw             主窗口对象
         * @param[i]  oper           操作器对象
         * @param[i]  section        截面对象
         * @author BaGuijun (baguijun@163.com)
         * @date 2024-04-25
         */
        SectionInfoDialog(QWidget* mw, EventOper::ParaWidgetInterfaceOperator* oper, Interface::FITKAbaAbastractSection* section);
        /**
         * @brief Destroy the Section Info Dialog object
         * @author BaGuijun (baguijun@163.com)
         * @date 2024-04-22
         */
        ~SectionInfoDialog();
        /**
         * @brief 初始化材料下拉列表
         * @author BaGuijun (baguijun@163.com)
         * @date 2024-04-22
         */
        void initMaterialList();
        /**
         * @brief 初始化梁剖面下拉列表
         * @author BaGuijun (baguijun@163.com)
         * @date 2024-04-22
         */
        void initProfileList();
    private slots:
        /**
         * @brief “ok”按钮响应槽函数
         * @author BaGuijun (baguijun@163.com)
         * @date 2024-04-22
         */
        void on_pb_ok_clicked();
        /**
         * @brief “cancel”按钮响应槽函数
         * @author BaGuijun (baguijun@163.com)
         * @date 2024-04-22
         */
        void on_pb_cancel_clicked();
        /**
         * @brief 材料创建按钮响应槽函数
         * @author BaGuijun (baguijun@163.com)
         * @date 2024-04-22
         */
        void on_actionMaterialCreate_clicked();
        /**
         * @brief 梁剖面创建按钮响应槽函数
         * @author BaGuijun (baguijun@163.com)
         * @date 2024-04-22
         */
        void on_actionBeamProfileCreate_clicked();
        /**
         * @brief 梁截面下拉框选择槽函数
         * @param[i]  index          combox索引
         * @author BaGuijun (baguijun@163.com)
         * @date 2024-06-12
         */
        void on_comb_pname_currentIndexChanged(int index);
    private:
        /**
         * @brief 初始化对话框
         * @author BaGuijun (baguijun@163.com)
         * @date 2024-04-22
         */
        void initDialog();
        /**
         * @brief 数据保存前校验表单数据
         * @return 校验结果
         * @author BaGuijun (baguijun@163.com)
         * @date 2024-04-22
         */
        bool checkDialog();
        /**
         * @brief comb_pname控件的文本
         * @param[i]  profile        截面对象
         * @author BaGuijun (baguijun@163.com)
         * @date 2024-06-12
         */
        void comb_pnameTextChange(Interface::FITKAbaProfile* profile);
    private:
        /**
         * @brief ui对象
         * @author BaGuijun (baguijun@163.com)
         * @date 2024-04-22
         */
        Ui::SectionInfoDialog* _ui = nullptr;
        /**
         * @brief 名称
         * @author BaGuijun (baguijun@163.com)
         * @date 2024-04-22
         */
        QString _name = "";
        /**
         * @brief 类型
         * @author BaGuijun (baguijun@163.com)
         * @date 2024-04-22
         */
        Interface::FITKAbaAbastractSection::FITKAbaSectionType _type{ };
        /**
         * @brief 截面对象
         * @author BaGuijun (baguijun@163.com)
         * @date 2024-04-22
         */
        Interface::FITKAbaAbastractSection* _section = nullptr;
        /**
         * @brief 是否创建截面
         * @author BaGuijun (baguijun@163.com)
         * @date 2024-04-22
         */
        bool _isCreate{ };
        /**
         * @brief 操作器对象
         * @author BaGuijun (baguijun@163.com)
         * @date 2024-04-25
         */
        EventOper::ParaWidgetInterfaceOperator* _oper = nullptr;
    };
}  // namespace GUI
#endif  // SECTIONINFODIALOG_H
